﻿using System;
using System.Drawing.Design;
using System.ComponentModel;
using System.Windows.Forms.Design;
using System.Windows.Forms;
using System.ComponentModel.Design;
using EnvDTE;

namespace com.code.Editors
{
    class CommanNamespaceEditor : UITypeEditor
    {
        IDictionaryService dictionaryService = null;
        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.Modal;
        }

        public override object EditValue(ITypeDescriptorContext context,
            IServiceProvider provider, object value)
        {
            dictionaryService = provider.GetService(typeof(IDictionaryService)) as IDictionaryService;
            EnvDTE.Project prj = (EnvDTE.Project)
             dictionaryService.GetValue("CommonProject");
            if (prj != null)
                return prj.Properties.Item("DefaultNamespace").Value.ToString();
            return "Default namespace";
        }
    }
}

